# -*- coding: utf-8 -*-
# @Time : 2021/7/3 0:28
# @Author : feimaotuiya
# @File : page_ecshop_front_cat_shopping_cart.py
# @Project : ecshop-gitee
import time

from selenium.webdriver.common.by import By


class PageEcshopFrontCatShoppingCart():
    # 查看购物车
    def __init__(self, driver):
        self.driver = driver
        # 元素定位
        self.loc_front_ecshop_cat_shopping_cart_link_text = (By.LINK_TEXT, '查看购物车')
        self.loc_front_ecshop_cat_shopping_assert = (By.XPATH, '//form[@id="formCart"]/table[1]/tbody/tr[1]/th[5]')
        # 点击购物车

    def front_ecshop_cat_shopping_cart_link_text(self):
        self.driver.find_element(*self.loc_front_ecshop_cat_shopping_cart_link_text).click()

        # 断言

    def front_ecshop_cat_shopping_assert(self):
        actual = self.driver.find_element(*self.loc_front_ecshop_cat_shopping_assert).text
        return actual

    def cat_shopping_cart(self):
        self.front_ecshop_cat_shopping_cart_link_text()
        time.sleep(3)
        actual = self.front_ecshop_cat_shopping_assert()
        return actual
